<?php
include ("../lib/BLL/LopMonBLL.php");
include ("../lib/BLL/ChiTietLopMonBLL.php");
include ("../lib/BLL/LapLichBLL.php");

$ctlm= new ChiTietLopMonBLL();
$lopmonBLL=new LopMonBLL();
$laplich= new LapLichBLL();

if(isset($_POST['duyetlich'])){
    $ma_cb=$_SESSION['ma_cb'];
    $nhomlich=$_POST['nhomlich'];
    $laplich->DuyetLich($ma_cb,$nhomlich);    
}

    $getlich=$_GET['lich'];
    $tt_nguoilap=$laplich->get_CanBoLap($getlich);
    $ma_cb_laplich=$tt_nguoilap['ma_cb'];
    $hoten=$tt_nguoilap['hh_hoten_cb'];
    $nguoiduyet=$laplich->get_CanBoDuyet($getlich);
    $lich=$lopmonBLL->getLich_ByNhomLich($getlich);
    
    $dslopmon="";
    foreach($lich as $lm){
        $dslopmon.="'".$lm['ma_lopmon']."',";
    }
    $dslopmon=rtrim($dslopmon,',');
    $ds_lichthi=$ctlm->Getngaythi_lopmon($dslopmon);

$smarty->assign('getlich',$getlich);
$smarty->assign('ma_cb',$_SESSION['ma_cb']);
$smarty->assign('ma_cb_laplich',$ma_cb_laplich);
$smarty->assign('hoten',$hoten);
$smarty->assign('nguoiduyet',$nguoiduyet);
$smarty->assign('lich',$lich);
$smarty->assign('ds_lichthi',$ds_lichthi);


$smarty->display('daotao/chitiet_lich.tpl');
?>